﻿using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Text;

namespace Template.Infrastructure.Filter
{
    /// <summary>
    /// 分页数据
    /// </summary>
    /// <typeparam name="T"></typeparam>
    public class PageData<T>
    {

        public PageData() : this(new T[0], 0, "请求成功", true)
        {

        }
        public PageData(IEnumerable<T> data, int total, string message = "请求成功", bool success = true)
        {
            Data = data;
            Total = total;
            Success = success;
            this.Message = message;
        }

        [JsonProperty("data")]
        public IEnumerable<T> Data { get; set; }

        [JsonProperty("total")]
        public int Total { get; set; }


        [JsonProperty("success")]
        public bool Success { get; set; }

        [JsonProperty("message")]
        public string Message { get; set; }
    }
}
